package com.ease.util {

   import flash.net.getClassByAlias;
   import flash.utils.getDefinitionByName;

   /**
    * Default implementation of IClassLoader.  The classes to be loaded are defined in
    * the current application domain.
    */
   public class DefaultClassLoader implements IClassLoader {
      /**
       * @inheritDoc
       */
      public function instantiate(className:String, callback:AsyncCallback, loadInfo:Object = null):void {
         if (callback == null) {
            throw new ArgumentError("Callback is required.");
         }

         try {
            var clazz:Class = getDefinitionByName(className) as Class;
            callback.result(new clazz());
            return;
         } catch (e:Error) {
            callback.fault(e);
         }
      }

      /**
       * @inheritDoc
       */
      public function getClassLoadInfo(instance:Object):Object {
         return null;
      }
   }

}